<template>
   <div class="content">
      <div class="title">{{data.title}}</div>
      <div class="item" v-for="item in data.data" :key="item.id">
        <span>{{item.title}}</span>
        <el-button type="primary" @click="showDetail">查看详情</el-button>
      </div>
      <div class="pagination">
        <el-pagination
        prev-text="上一页"
        next-text="下一页"

            background
            layout="prev, pager, next"
            @prev-click="currentChange"
            @next-click="currentChange"
            @current-change="currentChange"
            :current-page="currentPage"
            :total="data.totalPages">
            </el-pagination>
        </div>
    </div>
</template>
<script>
export default {
    props:{
        data:{
            type:Object,
            default:()=>{
                return {}
            }
        },
        currentPage:{
            type:Number,
            default:1,
        }
    },
    methods:{
        currentChange(val){
            this.$emit('current-change',val);
        },
        showDetail(){
            let routeUrl = this.$router.resolve({
                
                name: "/",
                params:{id:78}
            });
            console.log('routeUrl: ', routeUrl);
            window.open(routeUrl.href/id, '_blank');
        }
    }
}
</script>
